import { Component } from '@angular/core';

@Component({
  selector: 'app-demo1',
  templateUrl: './demo1.component.html',
})
export class Demo1Component {
  value = new Date();
  timer;

  timeChange(date) {
    this.value = date;
    if(date) {
      let _h = date.getHours(),
          _m = date.getMinutes(),
          _s = date.getSeconds();

      this.timer = (_h < 10 ? '0' + _h : _h) + ':' + (_m < 10 ? '0' + _m : _m) + ':' + (_s < 10 ? '0' + _s : _s);
    } else {
      this.timer = '';
    };
  }

  openChange(e) {
    console.log(e);
  }
}
